import { createStore, combineReducers, applyMiddleware } from "redux";
import { composeWithDevTools } from "@redux-devtools/extension";

import logger from "redux-logger";
import thunk from "redux-thunk";

const initialState = {
  count: 0,
};
const rootReducer = (state = initialState, action: any) => {
  switch (action.type) {
    case "inc":
      return {
        ...state,
        count: state.count + 1,
      };
    default:
      return state;
  }
};

const store = createStore(
  rootReducer,
  composeWithDevTools(applyMiddleware(thunk, logger))
);

// 导出 store
export default store;
